const path = require('path')
const resolve = filePath => path.join(__dirname, './', filePath)

module.exports = {
    outputDir: 'docs',
    publicPath: '/v3-ui/',
    devServer: { port: '3366' },
    pages: {
        index: {
            entry: resolve('story/main.ts'),
            template: 'public/index.html',
            filename: 'index.html',
            title: '组件示例'
        }
    },
    // 这个两个插件会在我们的index单页面中的script标签加上 defer以及async属性，导致我们demo示例页面按需加载失效，去掉就好了。
    chainWebpack: config => {
        config.plugins
            .delete('prefetch-index')
            .delete('preload-index')
        config.resolve.alias
            .set('story', resolve('story'))
    },
    css: {
        loaderOptions: {
            sass: {
                prependData: `@import "src/style/global-import.scss";`
            },
        }
    },
}
